package com.robotic.test;

// For command 0x91910250: Autonomous Charging Request
// The request sends a simple integer value (0, 1, or 2).
// The response contains the current state of the charging manager.
public class ChargeManagerState {
    private int state;

    public ChargeManagerState(int state) {
        this.state = state;
    }

    public int getState() {
        return state;
    }

    public String getStateDescription() {
        switch (state) {
            case 0x0000: return "Idle";
            case 0x0001: return "Do Charge Task";
            case 0x0002: return "Charging";
            case 0x0003: return "Do Over Charge Task";
            case 0x0004: return "Pile Error";
            case 0x0005: return "Safety Warning: Please unplug the charger first";
            case 0x1002: return "Tag Receive Timeout";
            case 0x1003: return "Mark Launch Failed";
            case 0x1004: return "Go to Stack Failed (Timeout)";
            case 0x1005: return "No Tag Value";
            case 0x1006: return "Tag Pose Jump";
            case 0x1007: return "No Charge Plug (at charging pile)";
            case 0x100a: return "No Charge Plug (backed off from pile)";
            default: return "Unknown State";
        }
    }

    @Override
    public String toString() {
        return "ChargeManagerState{" +
                "state=" + getStateDescription() + " (0x" + Integer.toHexString(state) + ')' +
                '}';
    }
}
